package com.my.chapter11;

import java.util.*;

public class practice20 {
    private static Map<Character,Integer> map = new HashMap<Character,Integer>();
    static{
        map.put('a',0);
        map.put('e',0);
        map.put('i',0);
        map.put('o',0);
        map.put('u',0);
    }
    static void countWords(String[] str){

        for(String s:str){
            String words = s.toLowerCase();
            char[] chars = words.toCharArray();
            for(char c:chars){
                if(map.containsKey(c)){
                    Integer count = map.get(c);
                    map.put(c,++count);
                }
            }
        }

    }

    public static void main(String[] args) {
        String s = "A contented mind is the greatest blessing a man can enjoy in this world";
        String[] str = s.split(" ");
        countWords(str);
        System.out.println(map);
    }
}
